/**
 * This class provide methods for creating data message 
 * which is to be communicated between client and server.
 * 
 * @author pkulkar@ncsu.edu
 */
package com.android.networking.message;
import java.net.InetAddress;
import java.util.ArrayList;


public class DataMessage {
	DataPacket localPack;
	
	public DataMessage(int sourceSeqNumber,int pointsPathLen, 
			ArrayList pointPath,String playerMode,String answer,ArrayList hint,String extraData){
		try{
		    localPack = new DataPacket();
		    localPack.setSourceSeqNumber(sourceSeqNumber);
		    localPack.setPointsPathLen(pointsPathLen);
		    localPack.setPointPath(pointPath);
		    localPack.setPlayerMode(playerMode);
		    localPack.setAnswer(answer);
		    localPack.setHint(hint);
		    localPack.setExtraData(extraData);
		}catch(Exception ex){
			ex.printStackTrace();
		}
		
	}
	public void createNewConnection(){
		try{
			localPack.setRequestType(DataRquestType.COORDINATES);
			localPack.computeChecksum();
		}catch(Exception ex){
			ex.printStackTrace();
		}
	}
	
	public void assignMulticastID(){
		try{
			localPack.setRequestType(DataRquestType.ANSWER);
			localPack.computeChecksum();
		}catch(Exception ex){
			ex.printStackTrace();
		}
	}
	
	public void clientClose(){
		try{
			localPack.setRequestType(DataRquestType.HINT);
			localPack.computeChecksum();
		}catch(Exception ex){
			ex.printStackTrace();
		}
	}
	
	public void displayControlMessage(){
		localPack.displayControlPacket();
	}
}
